﻿@using Bonesystem.Extensions
@model BoneSystem.Models.CadastroRestModel
<script type="text/javascript">

    MyComponents.Settings.UrlDelete = '@Model.UrlDelete';
    MyComponents.Settings.UrlEdit = '@Model.UrlEdit';
    MyComponents.Settings.UrlList = '@Model.UrlList';
    MyComponents.Settings.UrlLoadPopup = '@Model.UrlLoadPopup';
    MyComponents.Settings.UrlNew = '@Model.UrlNew';
    MyComponents.Settings.UrlSave = '@Model.UrlSave';
    MyComponents.Settings.FormName = '@Model.FormName';
    MyComponents.Settings.DialogName = '@Model.DialogName';
    
</script>
@{
    Html.DevExpress().PopupControl(settings =>
    {
        settings.Name = Model.DialogName;
        settings.Width = Unit.Pixel(Model.DialogWidth);
        settings.Height = Unit.Pixel(Model.DialogHeigth);
        settings.HeaderText = Model.DialogTitle;
        settings.AllowDragging = true;
        settings.CloseAction = CloseAction.CloseButton;
        settings.PopupAnimationType = AnimationType.Fade;
        settings.Modal = true;
        settings.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
        settings.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
        settings.SetContent(() => ViewContext.Writer.WriteLine(Model.PartialForm.ToHtmlString()));
    }).GetHtml();

}

@Html.DevExpress().Ribbon(settings =>
{
    settings.Name = Model.RibbonName + "Index";
    settings.ShowFileTab = false;
    
    settings.ClientSideEvents.Init = Model.FormName + "IndexRibbonInit";

    var tabCadastro = settings.Tabs.Add("Operações");

    var groupComands = tabCadastro.Groups.Add("Operações");

    groupComands.Items.Add(RibbonExtensions.CreateButtonItem<RibbonButtonItem>("btnNew", "Salvar", RibbonItemSize.Large, IconID.SaveSave32x32gray));
    groupComands.Items.Add(RibbonExtensions.CreateButtonItem<RibbonButtonItem>("btnEdit", "Excliur", RibbonItemSize.Large, IconID.EditDelete32x32gray));

    var tabRelatorio = settings.Tabs.Add("Grid");

    var groupRelatorio = tabRelatorio.Groups.Add("Opções");

    groupRelatorio.Items.Add(RibbonExtensions.CreateButtonItem<RibbonButtonItem>("btnExportPdf", "PDF", RibbonItemSize.Large, IconID.SaveSave32x32gray));
    groupRelatorio.Items.Add(RibbonExtensions.CreateButtonItem<RibbonButtonItem>("btnExportCsv", "CSV", RibbonItemSize.Large, IconID.EditDelete32x32gray));
    groupRelatorio.Items.Add(RibbonExtensions.CreateButtonItem<RibbonButtonItem>("btnExportExcel", "Excel", RibbonItemSize.Large, IconID.ActionsClose32x32));

}).GetHtml()
